package com.eshop.enums;

import java.util.stream.Stream;

public enum BillInfoEnum
{
    DEAFUL_ALL(Integer.valueOf(0), "所有"), 
    PAY_PRODUCT(Integer.valueOf(1), "消费"), 
    RECHAREGE(Integer.valueOf(2), "充值"), 
    BROKERAGE(Integer.valueOf(3), "返佣"), 
    EXTRACT(Integer.valueOf(4), "提现"), 
    SIGN_INTEGRAL(Integer.valueOf(5), "签到积分"), 
    PAY_PRODUCT_REFUND(Integer.valueOf(6), "退款"), 
    SYSTEM_ADD(Integer.valueOf(7), "系统添加"), 
    SYSTEM_SUB(Integer.valueOf(8), "系统减少");
    
    private Integer value;
    private String desc;
    
    public static BillInfoEnum toType(final int value) {
        return Stream.of(values()).filter(p -> p.value == value).findAny().orElse(null);
    }
    
    public Integer getValue() {
        return this.value;
    }
    
    public String getDesc() {
        return this.desc;
    }
    
    private BillInfoEnum(final Integer value, final String desc) {
        this.value = value;
        this.desc = desc;
    }
}
